package com.mls.fivedistrict.pojo;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableLogic;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 新闻评论
 * </p>
 *
 * @author Five Team
 * @since 2018-05-16
 */

@Data
@Accessors(chain = true)
@TableName(value = "t_news_comment", resultMap = "BaseResultMap")
public class NewsComment extends Model<NewsComment> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    private Long userId;
    /**
     * 新闻ID
     */
    @NotNull(message = "新闻id不能为空")
    private Long newsId;
    /**
     * 评论内容
     */
    @NotBlank(message = "评论内容不能为空")
    private String content;
    /**
     * 点赞次数
     */
    private Integer likeTimes;
    /**
     * 回复次数
     */
    private Integer replyTimes;
    /**
     * 排序
     */
    private Integer orders;
    /**
     * 1代表置顶
     */
    private Boolean top;
    private Date createDate;
    private Date updateDate;
    /**
     * 创建人
     */
    private String createBy;
    /**
     * 评论父节点ID
     */
    private Long parentCommentId;
    private transient User user;
    private transient NewsComment parentNewsComment;
    @TableLogic
    private Boolean isDelete;

    /**
     * 评论回复
     */
    private transient List<NewsComment> childrenNewsComment;

    /**
     * 是否点赞
     */
    private transient boolean isLike;

    public Boolean getDelete() {
        return isDelete;
    }

    public void setDelete(Boolean delete) {
        isDelete = delete;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
